<?php
/**
 * Introduction: 获取评论数据
 * @author: 杨陈鹏
 * @date: 2016/4/24 12:00
 * @email: yangchenpeng@cdlinglu.com
 */

namespace WeChat\Controller\Goods;


use Think\Controller;

class CommentNotSignController extends Controller
{
    /**
     * Introduction: 获取评论列表
     * @author: 杨陈鹏
     * @date: 2016/4/24 12:00
     * @email: yangchenpeng@cdlinglu.com
     */
    /*

var data = {

        page: 1,
        nums: 20,
        data:{

            goods_id: 34

        }

    }


*/
    public function lists()
    {

        $where = I('post.data');

        $logic = D('Common/GoodsComment','Logic');

        //$where['uid'] = self::$uid;

        //if(!$where)
        //    $where['uid'] = self::$uid;

        if(isset($where['type']) && empty($where['type']))
            unset($where['type']);

        //允许查询ID
        $page = I('post.page',1);

        $nums = I('post.nums',20);


        outPut($logic::getData($where, '*','likes desc,create_time desc', $page, $nums),true);

    }
    /**
     * Introduction: 评论点赞
     * @author: 杨陈鹏
     * @email: yangchenpeng@cdlinglu.com
     */
    public function like()
    {

        $data = I('post.data');

        $logic = D('Common/GoodsComment','Logic');

        $comment_id = $data['comment_id'];

        outPut($logic::like($comment_id));

    }

}